package com.qf.service;

import com.codingapi.txlcn.tc.annotation.LcnTransaction;
import com.qf.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestTemplate;

/**
 * @author lixu
 */
@Service
public class Z3ServiceImpl implements Z3Service{


    @Autowired
    private UserMapper userMapper;
    @Autowired
    private RestTemplate restTemplate;
    /**
     *
     */
    @Override
    @Transactional //本地事务注解
    //@LcnTransaction //分布式事务注解
    public void incr() {
        //1:远程调用 李四 减钱
        restTemplate.getForObject("http://localhost:8082/l4",String.class);
        //
        int i = 1/0;
        //2:张三是加钱
        userMapper.incr();

    }
}
